import Vue from "vue";
import Vuex from "vuex";

import Links from "./modules/links";
import Categories from "./modules/categories";
import Config from "./modules/config";
import Tag from "./modules/tag";
import Post from "./modules/post";
import Image from "./modules/image";

Vue.use(Vuex);
export default new Vuex.Store({
  state: {
    isMobile: false,
    systemConfig: {
      codeStyle: "github"
    }
  },
  getters: {
    isMobile(state) {
      return state.isMobile;
    },
    codeStyle(state) {
      return state.systemConfig.codeStyle;
    }
  },
  mutations: {
    setIsMobile(state, isMobile) {
      state.isMobile = isMobile;
    }
  },
  actions: {
    setIsMobile({ commit }, isMobile) {
      commit("setIsMobile", isMobile);
    }
  },
  modules: {
    Links,
    Categories,
    Config,
    Tag,
    Post,
    Image
  }
});
